﻿using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Admin
{
    public partial class View_IDs : Form
    {
        List<Stu_group> all_group;
        List<Teacher> all_teacher;
        public View_IDs()
        {
            InitializeComponent();
        }

        private void View_Data_Load(object sender, EventArgs e)
        {
            BLL.B_Group b_Group = new BLL.B_Group();
            BLL.B_Teacher b_Teacher = new BLL.B_Teacher();

            all_group = b_Group.getList().OrderBy(g => g.group_id).ToList();
            all_teacher = b_Teacher.GetList();

            Groups_view.DataSource = all_group;
            Teachers_view.DataSource = all_teacher;
            Teachers_view.Columns["pwd"].Visible = false;
            Teachers_view.Columns["teacher_uname"].Visible = false;
        }

        private void Groups_view_MouseClick(object sender, MouseEventArgs e)
        {
            if (Groups_view.Rows.Count == 0)
                return;
            int idx = Groups_view.CurrentCell.RowIndex;
            BLL.B_Student b_student = new BLL.B_Student();
            Group_member.DataSource = b_student.GetList(all_group[idx]);
            Group_member.Columns["pwd"].Visible = false;
        }
    }
}
